package com.library.Book.service.impl;

import com.library.Book.mapper.BookMapper;
import com.library.Book.model.Book;
import com.library.Book.model.BookExample;
import com.library.Book.service.BookService;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BookServiceImpl implements BookService {
    
    private BookMapper bookMapper;

    //通过构造函数注入mapper
    @Autowired
    public BookServiceImpl(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public long countByExample(BookExample example) {
        return bookMapper.countByExample(example);
    }

    public int deleteByExample(BookExample example) {
        return bookMapper.deleteByExample(example);
    }

    public int deleteByPrimaryKey(Integer id) {
        return bookMapper.deleteByPrimaryKey(id);
    }

    public int insert(Book record) {
        return bookMapper.insert(record);
    }

    public int insertSelective(Book record) {
        return bookMapper.insertSelective(record);
    }

    public List<Book> selectByExample(BookExample example) {
        return bookMapper.selectByExample(example);
    }

    public Book selectByPrimaryKey(Integer id) {
        return bookMapper.selectByPrimaryKey(id);
    }

    public int updateByExampleSelective(@Param("record") Book record, @Param("example") BookExample example) {
        return bookMapper.updateByExampleSelective(record, example);
    }

    public int updateByExample(@Param("record") Book record, @Param("example") BookExample example) {
        return bookMapper.updateByExample(record, example);
    }

    public int updateByPrimaryKeySelective(Book record) {
        return bookMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(Book record) {
        return bookMapper.updateByPrimaryKey(record);
    }
}